<template>
	<view class="main">
		<view class="row">
			<view class="list" v-if="list.length == 0">
				<view class="empty">暂无数据</view>
			</view>
			<view class="list" v-else>
				<view class="item" v-for="(item,index) in list" :key="index" @click="toPage('./detail?id='+item.id)">
					<view class="title">
						{{item.title}}
					</view>
					<!-- <view class="des" v-html="item.content"></view> -->
					<view class=""><br></view>
					<view class="time">
						{{item.create_time}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getNotice
	} from "@/api/api.js"
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad() {
			this.getNotice()
		},
		methods: {
			toPage(url) {
				uni.navigateTo({
					url
				})
			},
			getNotice() {
				getNotice().then(res => {
					if (res.code == 0) {
						this.list = res.data.data
					} else {
						uni.$showMsg(res.msg)
					}
				})
			}

		}
	}
</script>

<style lang="scss">
	page {
		background: #f3f5f8;
		box-sizing: border-box;
	}

	.empty {
		text-align: center;
		margin-top: 30%;
	}

	.row {
		margin-top: 10px;

		.list {
			padding: 0 3%;

			.item {
				background: #fff;
				border-radius: 5px;
				padding: 10px;
				box-sizing: border-box;
				margin-bottom: 15px;

				.title {
					font-size: 14px;
					font-weight: bold;
				}

				.des {
					font-size: 12px;
					color: #777;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
					overflow: hidden;
					margin: 10px 0;
				}

				.time {
					font-size: 12px;
					color: #777;
				}
			}
		}
	}
</style>